package com.zch.spring_demo.base.service;

import org.springframework.data.domain.Example;
import org.springframework.data.domain.Sort;

import java.util.List;

/**
 * @author biscuit
 * @data 2018/01/16
 * Spring jpa在service层的衍生,使项目开发的时候,更容易使用jpa API
 */
public interface IBaseService<T,ID> {
    /**增*/
    void save(T entity);
    /**删*/
    void delete(T entity);
    /**查所有*/
    List<T> findAll();

    List<T> findAll(Sort var1);

    List<T> findAll(Iterable<ID> var1);

    <S extends T> List<S> save(Iterable<S> var1);

    void flush();

    <S extends T> S saveAndFlush(S var1);

    void deleteInBatch(Iterable<T> var1);

    void deleteAllInBatch();

    T getOne(ID id);

    <S extends T> List<S> findAll(Example<S> var1);

    <S extends T> List<S> findAll(Example<S> var1, Sort var2);
}
